<?php


namespace Part25_ResponsibilityChainModel\Code1;

/**
 * 具体中介者类
 */
class ConcreteMediator extends Mediator
{
    /**
     * @var ConcreteColleague1
     */
    private $colleague1;

    /**
     * @var ConcreteColleague2
     */
    private $colleague2;

    /**
     * @param $value ConcreteColleague1
     */
    public function setColleague1($value)
    {
        $this->colleague1 = $value;
    }


    /**
     * @param $value ConcreteColleague2
     */
    public function setColleague2($value)
    {
        $this->colleague2 = $value;
    }

    public function send($message, $colleague)
    {
        if ($colleague == $this->colleague1) {
            $this->colleague2->notify($message);
        } else {
            $this->colleague1->notify($message);
        }
    }
}